﻿
using NHibernate;
using CRC.GestionSalones.Dominio.Clases;
namespace CRC.GestionSalones.Controladores
{
    public class ControladorEliminarSalon
    {
        public void eliminarSalon(int intIdSalon) 
        {
            ISession session = null;
            ITransaction tx = null;
            
            try 
            {
                session = NHibernate.NHibernateHelper.GetCurrentSession();
                tx = session.BeginTransaction();
                
                Salon salon = (Salon)session.Get(typeof(Salon), intIdSalon);
                session.Delete(salon);

                tx.Commit();
            }
            catch (HibernateException he) 
            { 
                if (tx != null) tx.Rollback();
                session.Close();
                throw he;
            }
        }
    }
}
